package com.huawei.appmarket.service.store.awk.card;

import android.content.Context;
import android.text.TextUtils;
import android.view.View;
import android.widget.ImageView;
import android.widget.RelativeLayout.LayoutParams;
import android.widget.TextView;
import com.huawei.appgallery.foundation.card.base.card.BaseDistCard;
import com.huawei.appgallery.foundation.ui.framework.cardkit.bean.CardBean;
import com.huawei.appgallery.foundation.ui.framework.widget.button.DownloadButton;
import com.huawei.appmarket.framework.widget.RoundImageView;
import com.huawei.appmarket.service.store.awk.bean.SubstanceAppDlCardBean;
import o.azb;
import o.cgz;
import o.epv;
import o.eqx;
import o.ewm.j;

public class SubstanceAppDlcard extends BaseDistCard {
    private SubstanceAppDlCardBean ʻ;
    private TextView ʼ;
    private ImageView ʽ;
    private RoundImageView ˋ;
    private TextView ॱॱ;
    private TextView ᐝ;

    public SubstanceAppDlcard(Context context) {
        super(context);
    }

    public cgz ˏ(View view) {
        azb.ॱ(view, j.ʾˈ);
        ˋ((DownloadButton) view.findViewById(j.ʹ));
        this.ˋ = (RoundImageView) view.findViewById(j.ꜞ);
        this.ᐝ = (TextView) view.findViewById(j.ꞌ);
        this.ॱॱ = (TextView) view.findViewById(j.ﾞ);
        this.ʽ = (ImageView) view.findViewById(j.ﹳ);
        this.ʼ = (TextView) view.findViewById(j.ㆍʼ);
        ʽ(view);
        return this;
    }

    public void ˏ(CardBean cardBean) {
        super.ˏ(cardBean);
        if (cardBean != null) {
            this.ʻ = (SubstanceAppDlCardBean) cardBean;
            ˋ();
            eqx.ˏ(this.ʽ, this.ʻ.ॱˌ(), "app_default_icon");
            if (TextUtils.isEmpty(this.ʻ.ॱ())) {
                this.ˋ.setVisibility(8);
            } else {
                this.ˋ.setVisibility(0);
                eqx.ˎ(this.ˋ, this.ʻ.ॱ());
            }
            if (this.ʻ.ٴ() != 0) {
                this.ॱॱ.setText(this.ʻ.ߴ());
            } else {
                this.ॱॱ.setText(this.ʻ.ˊ());
            }
            this.ᐝ.setText(this.ʻ.ʽ());
            ˋ(this.ʼ, this.ʻ.ˋʻ());
            ᐝ(this.ॱॱ);
        }
    }

    private void ˋ() {
        int ꜟ = this.ʻ.ꜟ();
        int ˊ = azb.ˊ(this.ʼॱ);
        int ˏ = azb.ˏ(this.ʼॱ);
        int ʻ = epv.ʻ(this.ʼॱ);
        LayoutParams layoutParams = (LayoutParams) this.ˋ.getLayoutParams();
        int ˎ = epv.ˎ(this.ʼॱ);
        if (ꜟ == 0) {
            ˎ = (ˎ - ˊ) - ˏ;
            layoutParams.setMargins(ˊ, 0, ˏ, 0);
            this.ˋ.setRadius(ʻ);
        } else {
            layoutParams.setMargins(0, 0, 0, 0);
            this.ˋ.setRadius(0);
        }
        layoutParams.height = (int) (((double) ˎ) * 0.5625d);
        layoutParams.width = -1;
        this.ˋ.setLayoutParams(layoutParams);
    }
}
